<?php
/**
 * @date        <!-- phpDesigner :: Timestamp [08-07-2010 00:23:24] -->
 * @filesource  class.content.php
 * @package     WebCms
 * @copyright	Copyright (C) 2010
 * @author      Sérgio 'Horizak' Alves
 */

// Sem acesso directo
defined('_WEXEC') or die('Restricted access');

/**
 * Content component
 *
 */
class Component_Content extends Component {
  /**
   * Função construtora
   * 
   */
  function __construct() {
    $this->name = 'Content';
    $this->patch = dirname(__file__).DS;
    parent::__construct();
  }

  function getPage($params = array()) {
    global $cms;

    if (isset($cms->global['get']['a'])) $page = $cms->global['get']['a'];

    $sql = "SELECT * FROM ".DBCONTENT;

    if (isset($page)) $sql .= " WHERE alias = '{$page}'";
    else  $sql .= " WHERE defaulting = '1'";

    if ($cms->obj['mysql']->getTotal($sql,'component')) $array = mysql_fetch_array($cms->obj['mysql']->component);
    
    $this->show($array['value'],'string');
  }
}
?>